var t = require;
var e = module;
var o = exports;
var n =
    (this && this.__extends) ||
    (function () {
        var t = function (e, o) {
            return (t =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (t, e) {
                        t.__proto__ = e;
                    }) ||
                function (t, e) {
                    for (var o in e) e.hasOwnProperty(o) && (t[o] = e[o]);
                })(e, o);
        };
        return function (e, o) {
            function n() {
                this.constructor = e;
            }
            t(e, o), (e.prototype = null === o ? Object.create(o) : ((n.prototype = o.prototype), new n()));
        };
    })();
Object.defineProperty(o, "__esModule", {value: !0});
var r = t("fsm"),
    a = t("fightManager"),
    i = t("skillbox"),
    s = t("skillMove"),
    c = t("telepole"),
    l = t("bodyDefenseEnter"),
    u = t("bodyIdle"),
    p = (function (t) {
        function e() {
            var e = (null !== t && t.apply(this, arguments)) || this;
            return (e.time = 0), e;
        }
        return (
            n(e, t),
            (e.prototype.onEnter = function () {
                c.default.inst.isMove() && (this.context.direction.value = c.default.inst.v2.x > 0 ? -1 : 1),
                    this.skill.use(this.context),
                    (this.skillbox = this.context.addComponent(i.default)),
                    (this.skillbox.skill = this.skill),
                    this.context.sk.play(this.skill.data.skname, !1, this, this.onskend),
                    this.skill.data.juli &&
                        ((this.skillMove = this.context.addComponent(s.default)),
                        (this.skillMove.body = this.context),
                        (this.skillMove.skill = this.skill));
            }),
            (e.prototype.onskend = function () {
                this.context.state == this && r.changeState(this.context, u.default);
            }),
            (e.prototype.onExit = function () {
                this.skillbox.destroy(), this.skillMove && this.skillMove.isValid && this.skillMove.destroy();
            }),
            (e.prototype.onMove = function () {}),
            (e.prototype.onMoveStop = function () {}),
            (e.prototype.onUpdate = function (t) {
                this.time += a.default.gamedt(t);
            }),
            (e.prototype.on_skill = function (t) {
                this.time >= this.skill.data.CancelTime && r.changeState(this.context, e, {skill: t});
            }),
            (e.prototype.on_enter_defense = function () {
                r.changeState(this.context, l.default);
            }),
            e
        );
    })(t("bodyState").default);
o.default = p;
